package com.zyh.demo;

import java.util.ArrayList;
import java.util.Scanner;

public class StringDemo4 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        InterStringDemo4 inter=new InterStringDemo4() {
            @Override
            public void delete(String str1, String str2) {
                System.out.println("请输入源字符串：");
                str1 = input.nextLine();
                int start = str1.length();
                System.out.println("请输入要删除的字符串：");
                str2 = input.nextLine();
                while (str1.contains(str2)) {
                    String replace = str1.replace(str2, "");
                }
                int end = str1.length();
                System.out.println("源字符串包含"+(start-end)/str2.length()+"个"+str2);
                System.out.println("删除"+str2+"后的字符串为："+str1);
            }
        };
        inter.delete("java woaijava,i like jajavava i enjoy java","ja");
    }
}
